<?php

class Eleven_Form_Teacher_Publish extends Zend_Form
{
	public function init()
	{
	    $this->setDisableLoadDefaultDecorators(true);
        $this->setDecorators(array(
            array(
                'ViewScript',
                array('viewScript'=>'teacher/_publish.phtml')
            ),
            'Form'
        ));
        
        $this->setAttrib('enctype', 'multipart/form-data');
	    
	    $this->addElementPrefixPath(
            'Eleven_Validate',
            APPLICATION_PATH . '/models/validate/',
            'validate'
        );
	    
		$this->addElement('text', 'title', array(
			'required'		=> true,
			'label'			=> '活动标题：',
		));
		$this->getElement('title')->setDecorators(array(
            'ViewHelper',
		    'Errors',
        ));
        $this->getElement('title')->setAttrib('size', 67);
		
		$this->addElement('textarea', 'content', array(
			'required'		=> true,
			'label'			=> '活动内容：',
		));
		$this->getElement('content')->setDecorators(array(
            'ViewHelper',
		    'Errors',
        ));
        
        $file1 = new Zend_Form_Element_File('file');
        $file1->setMaxFileSize(20000000)
            ->setDestination('./data/uploads/teacher/')
            ->addPrefixPath('Eleven_Validate',APPLICATION_PATH . '/models/validate/','validate')
            ->addValidator('Count', false, 1)
            ->addValidator('Size', false, 10240000)
            ->addValidator('CFExtension', false, 'jpg,png,gif,pdf,rar,doc,xls,ppt,docs,xlsx,pptx,mp3,avi,rm,rmvb,zip');
        $file1->removeDecorator('Label');
        $file1->removeDecorator('HtmlTag');
        $file1->setAttribs(array('class'=>'pic_file', 'size'=>'43'));
		
        $this->addElement($file1);
		$this->addElement('submit', 'submit', array(
			'ignore'		=> true,
		));
		$this->getElement('submit')->setAttrib('class','submit');
		$this->getElement('submit')->setLabel('');
		
	}

}

?>